/* GUI CONVERTED from rcvrfsh.p (converter v1.75) Tue Apr 10 12:06:13 2001 */
/* rcvrfsh.p - VERIFY SHIPPER STRUCTURE AND CONTENTS                          */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.6.2.4 $                                                         */
/*V8:ConvertMode=Report                                                       */
/* REVISION: 8.6      LAST MODIFIED: 09/20/96   BY: TSI *K005*                */
/* REVISION: 8.6      LAST MODIFIED: 03/15/97   BY: *K04X* Steve Goeke        */
/* REVISION: 8.6      LAST MODIFIED: 07/02/97   BY: *K0FW* Steve Nugent       */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan         */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* Mark Brown         */
/* REVISION: 9.1      LAST MODIFIED: 09/25/00   BY: *N0WD* BalbeerS Rajput    */
/* $Revision: 1.6.2.4 $    BY: Jean Miller          DATE: 03/22/01 ECO: *P008*    */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "b+ "}
{cxcustom.i "RCVRFSH.P"}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rcvrfsh_p_1 "Ship-From"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcvrfsh_p_2 "Pre-Shipper/Shipper"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcvrfsh_p_3 "Number"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

/* INPUT VARIABLES */
define shared variable global_recid as recid.

/* LOCAL VARIABLES */
define variable disp_abs_id as character no-undo.
define variable errors      as logical no-undo.
define variable doc_type    as logical format {&rcvrfsh_p_2}no-undo.
define variable t_doctype   as character no-undo.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
abs_shipfrom         colon 33 label {&rcvrfsh_p_1}
   si_desc              at 45 no-label
   doc_type             colon 33 label {&rcvrfsh_p_2}
   abs_id               colon 33 label {&rcvrfsh_p_3} format "x(20)"
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

/* CHECK IF EXISTING RECORD WITH GLOBAL_RECID */
find abs_mstr where recid(abs_mstr) = global_recid
no-lock no-error.

if available abs_mstr
   and abs_type = "S"
   and (abs_id begins "P" or abs_id begins "S")
then do:

   find si_mstr where si_site = abs_shipfrom no-lock.

   doc_type = abs_mstr.abs_id begins "P".

   display
      abs_shipfrom
      si_desc
      doc_type
      substring(abs_id,2,20) @ abs_id
   with frame a.

end.

mainloop:
repeat with frame a:

   display
      doc_type.

   prompt-for
      abs_shipfrom
      doc_type
      abs_id
   editing:

      if recno <> ? then do:

         find si_mstr where si_site = abs_shipfrom no-lock no-error.

         disp_abs_id = substring(abs_id,2,20).

         display
            abs_shipfrom
            si_desc      when (available si_mstr)
            abs_id begins "P" @ doc_type
            ""           when (not available si_mstr) @ si_desc
            disp_abs_id @ abs_id.

      end.

      if frame-field = "abs_shipfrom" then do:
         {mfnp05.i abs_mstr abs_id
            "(abs_id begins 'S' or abs_id begins 'P')"
            abs_shipfrom "input abs_shipfrom"}
      end. /* IF FRAME_FIELD = ABS_SHIPFROM */

      else
      if frame-field = "abs_id" then do:

         t_doctype = if input doc_type then "P" else "S".

         {mfnp05.i abs_mstr abs_id
            "abs_shipfrom = input abs_shipfrom and abs_id begins t_doctype"
            abs_id "t_doctype + input abs_id"}

      end. /* IF FRAME_FIELD = ABS_ID */

      else do:
         status input.
         readkey.
         apply lastkey.
      end.

   end. /* PROMPT FOR EDITING */

   /* CHECK FOR VALID SITE */
   find si_mstr where si_site = input abs_shipfrom no-lock no-error.

   if not available si_mstr then do:
      /* SITE DOES NOT EXIST */
      {pxmsg.i &MSGNUM=708 &ERRORLEVEL=3}
      next-prompt abs_shipfrom.
      undo mainloop, retry mainloop.
   end. /* IF NOT AVAILABLE SI_MSTR */

   display
      si_desc.

   assign
      global_site = si_site
      doc_type
      t_doctype = if doc_type then "P" else "S".

   find abs_mstr where
        abs_shipfrom = input abs_shipfrom and
        abs_id       = t_doctype + input abs_id
   no-lock no-error.

   if not available abs_mstr then do:
      /* Picklist/Shipper does not exist */
      {pxmsg.i &MSGNUM=8145 &ERRORLEVEL=3}
      next-prompt abs_id.
      undo mainloop, retry mainloop.
   end.  /* if not available */

   {&RCVRFSH-P-TAG1}

   if abs_inv_mov <> "" and
      not can-find (first im_mstr where
                          im_inv_mov = abs_inv_mov and
                          im_tr_type = "ISS-SO")
   then do:
      {&RCVRFSH-P-TAG2}
      /* NOT A SALES ORDER SHIPPER */
      {pxmsg.i &MSGNUM=5802 &ERRORLEVEL=3}
      undo mainloop, retry mainloop.
   end.  /* if abs_inv_mov */

   /* OUTPUT DESTINATION SELECTION */
   {gpselout.i &printType = "printer"
               &printWidth = 132
               &pagedFlag = " "
               &stream = " "
               &appendToFile = " "
               &streamedOutputToTerminal = " "
               &withBatchOption = "no"
               &displayStatementType = 1
               &withCancelMessage = "yes"
               &pageBottomMargin = 6
               &withEmail = "yes"
               &withWinprint = "yes"
               &defineVariables = "yes"}
/*GUI*/ RECT-FRAME:HEIGHT-PIXELS in frame a = FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.


   {mfphead2.i}

   global_recid = recid(abs_mstr).

   {gprun.i ""rcvrfsh1.p""
      "(input recid(abs_mstr),
        input false,
        input true,
        output errors)"}

   {mfrtrail.i}

end. /* mainloop */
